/***************************************************************************
 *   Copyright (C) 2007 by Luca Bellonda                                   *
 *   lbell @ tsc4.com                                                      *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
package lb.prove;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class RssItemView extends LinearLayout {
	boolean isRead=false;
	String	Title="";
	TextView mTitle;
	ImageView mView;
	RssItem mItem;
	public RssItemView(Context context, RssItem item)
	{
		super(context);
		mItem = item;
		this.setOrientation(HORIZONTAL);
		setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
		if(false)return;
        mView = new ImageView(mContext);
        mView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        addView(mView);
        mTitle = new TextView(context);
        mTitle.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        addView(mTitle);
        setRssItem(item);
	}
	public void setRssItem(RssItem item)
	{
		mItem=item;
		if(null==mItem)
		{
			mTitle.setText("");
			mView.setImageResource(R.drawable.read);
			mView.setAdjustViewBounds(true);
			return ;
		}
		mTitle.setText(mItem.title);
		mView.setImageResource(mItem.read?R.drawable.read:R.drawable.toread);
		mView.setAdjustViewBounds(true);
	}

}
